import sys
from time import time

class LogManager:
    _log = []
    out = sys.__stdout__.write
    
    def log(self, entry):
        self.out(entry)
        self._log.append((time(), entry))
        
    def __call__(self, entry):
        self.log(entry)
    
    def setOutput(self, output=None):
        if not output:
            self.out = lambda *args:True
            return
        else:
            self.out = output
        
    def alert(self, entry):
        self.log('<alert>%s</alert>'%entry)
